using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Core.Mapping;
using Core.Graphics;


namespace WorldEditor
{
    public partial class PalletTile : UserControl
    {
        TileSetTile _Tile;

        public TileSetTile GetUnderlyingTile
        {
            get { return _Tile; }
        }

        public bool IsActiveTile
        {
            set
            {
                if (value)
                {
                    pbTile.BorderStyle = BorderStyle.FixedSingle;
                    
                }
                else
                {
                    pbTile.BorderStyle = BorderStyle.None;
                }
            }
        }

        public event EventHandler PalletTileSelected;

        public PalletTile(TileSetTile tile)
        {
            _Tile = tile;
            InitializeComponent();
        }

        private void PalletTile_Load(object sender, EventArgs e)
        {
            //Set Image
            pbTile.Image = TileSetTileBitmaps.GetTileBitmap(_Tile.SpriteID, TileSetTypes.Terrain);
        }

        private void pbTile_Click(object sender, EventArgs e)
        {
            if (PalletTileSelected != null)
                PalletTileSelected.Invoke(this, e);
        }
    }
}
